#include "PollServer.hpp"
#include <memory>
#include <string>

void Usage(std::string proc)
{
    std::cout << "\n\tUsage:\n\t\t" << proc << "\tport\n" << std::endl;
}

void test(std::string tst)
{

}

std::string transaction(std::string req)
{
    std::string resp("echo# ");
    resp += req;
    return resp;
}

// ./selectServer 8080
int main(int argc, char* argv[])
{
    if(argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE);
    }
    
    // std::cout << sizeof(fd_set) << std::endl;//debug

    uint16_t port = atoi(argv[1]);

    std::unique_ptr<poll_ns::PollServer> ssvr(new poll_ns::PollServer(transaction,port));

    ssvr->initServer();
    ssvr->start();
    
    return 0;
}